#include "AppStateManager.h"

AppStateManager::AppStateManager() : activeAppState_(0)     {}

AppStateManager* AppStateManager::GetInstance()
{
    static AppStateManager instance;
    return &instance;
}

void AppStateManager::SetActiveAppState(int id)
{
    if (activeAppState_)
        activeAppState_->OnDeactivate();

    switch (id)
    {
        case AppState::SplashScreen         :   activeAppState_ = &appStateSplashScreen_;
                                                activeAppState_->OnActivate();
                                                break;

        case AppState::DisplayMandelbrot    :   activeAppState_ = &appStateMandelbrot_;
                                                activeAppState_->OnActivate();
                                                break;
    }
}

void AppStateManager::OnLoop(sf::RenderWindow& window)
{
    activeAppState_->OnLoop(window);
}



